<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilflash: Library-APIs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilflash
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__xilflash__apis.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Library-APIs</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gab4c908ad78f6ded9407d0dc7ed611370"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#gab4c908ad78f6ded9407d0dc7ed611370">XFlash_Initialize</a> (XFlash *InstancePtr, u32 BaseAddress, u8 BusWidth, int IsPlatformFlash)</td></tr>
<tr class="memdesc:gab4c908ad78f6ded9407d0dc7ed611370"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function initializes a specific XFlash instance.  <a href="#gab4c908ad78f6ded9407d0dc7ed611370">More...</a><br/></td></tr>
<tr class="separator:gab4c908ad78f6ded9407d0dc7ed611370"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacef8005e70142f8113fa163cb5a187f5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#gacef8005e70142f8113fa163cb5a187f5">XFlash_Reset</a> (XFlash *InstancePtr)</td></tr>
<tr class="memdesc:gacef8005e70142f8113fa163cb5a187f5"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function resets the flash device and places it in read mode.  <a href="#gacef8005e70142f8113fa163cb5a187f5">More...</a><br/></td></tr>
<tr class="separator:gacef8005e70142f8113fa163cb5a187f5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee7e52b5702a9d346c97ceb56fd4829c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#gaee7e52b5702a9d346c97ceb56fd4829c">XFlash_DeviceControl</a> (XFlash *InstancePtr, u32 Command, DeviceCtrlParam *Parameters)</td></tr>
<tr class="memdesc:gaee7e52b5702a9d346c97ceb56fd4829c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is used to execute device specific commands.  <a href="#gaee7e52b5702a9d346c97ceb56fd4829c">More...</a><br/></td></tr>
<tr class="separator:gaee7e52b5702a9d346c97ceb56fd4829c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2b079c7388012f6bdbda754ea0d62641"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#ga2b079c7388012f6bdbda754ea0d62641">XFlash_Read</a> (XFlash *InstancePtr, u32 Offset, u32 Bytes, void *DestPtr)</td></tr>
<tr class="memdesc:ga2b079c7388012f6bdbda754ea0d62641"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function reads the data from the Flash device and copies it into the specified user buffer.  <a href="#ga2b079c7388012f6bdbda754ea0d62641">More...</a><br/></td></tr>
<tr class="separator:ga2b079c7388012f6bdbda754ea0d62641"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gadeef4a4805428c7a14578bc0790d6bdc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#gadeef4a4805428c7a14578bc0790d6bdc">XFlash_Write</a> (XFlash *InstancePtr, u32 Offset, u32 Bytes, void *SrcPtr)</td></tr>
<tr class="memdesc:gadeef4a4805428c7a14578bc0790d6bdc"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function programs the flash device(s) with data specified in the user buffer.  <a href="#gadeef4a4805428c7a14578bc0790d6bdc">More...</a><br/></td></tr>
<tr class="separator:gadeef4a4805428c7a14578bc0790d6bdc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga13e5d44757867a2f424f885ac51890c2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#ga13e5d44757867a2f424f885ac51890c2">XFlash_Erase</a> (XFlash *InstancePtr, u32 Offset, u32 Bytes)</td></tr>
<tr class="memdesc:ga13e5d44757867a2f424f885ac51890c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function erases the specified address range in the flash device.  <a href="#ga13e5d44757867a2f424f885ac51890c2">More...</a><br/></td></tr>
<tr class="separator:ga13e5d44757867a2f424f885ac51890c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga61597f564c68519fd4449b9fe6c50339"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#ga61597f564c68519fd4449b9fe6c50339">XFlash_Lock</a> (XFlash *InstancePtr, u32 Offset, u32 Bytes)</td></tr>
<tr class="memdesc:ga61597f564c68519fd4449b9fe6c50339"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function Locks the blocks in the specified range of the flash device(s).  <a href="#ga61597f564c68519fd4449b9fe6c50339">More...</a><br/></td></tr>
<tr class="separator:ga61597f564c68519fd4449b9fe6c50339"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad42077db3972cee5f052a5a5063fe538"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#gad42077db3972cee5f052a5a5063fe538">XFlash_Unlock</a> (XFlash *InstancePtr, u32 Offset, u32 Bytes)</td></tr>
<tr class="memdesc:gad42077db3972cee5f052a5a5063fe538"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function Unlocks the blocks in the specified range of the flash device(s).  <a href="#gad42077db3972cee5f052a5a5063fe538">More...</a><br/></td></tr>
<tr class="separator:gad42077db3972cee5f052a5a5063fe538"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga58e08e78cda5a44e67a7ec99fab303d0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xilflash__apis.html#ga58e08e78cda5a44e67a7ec99fab303d0">XFlash_IsReady</a> (XFlash *InstancePtr)</td></tr>
<tr class="memdesc:ga58e08e78cda5a44e67a7ec99fab303d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function checks the readiness of the device, which means it has been successfully initialized.  <a href="#ga58e08e78cda5a44e67a7ec99fab303d0">More...</a><br/></td></tr>
<tr class="separator:ga58e08e78cda5a44e67a7ec99fab303d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaee7e52b5702a9d346c97ceb56fd4829c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_DeviceControl </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">DeviceCtrlParam *&#160;</td>
          <td class="paramname"><em>Parameters</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is used to execute device specific commands. </p>
<p>For a list of device specific commands, see the <a class="el" href="xilflash_8h.html">xilflash.h</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Command</td><td>Device specific command to issue. </td></tr>
    <tr><td class="paramname">Parameters</td><td>Specifies the arguments passed to the device control function.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_NOT_SUPPORTED if the command is not recognized/supported by the device(s).</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__devicecontrol__example_8c.html#a5fa72d691594e1137b534052172c88c8">FlashDeviceControlExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="ga13e5d44757867a2f424f885ac51890c2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Erase </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function erases the specified address range in the flash device. </p>
<p>The number of bytes to erase can be any number as long as it is within the bounds of the device(s).</p>
<p>The device is polled until an error or the operation completes successfully.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Offset</td><td>Offset into the device(s) address space from which to begin erasure. </td></tr>
    <tr><td class="paramname">Bytes</td><td>Number of bytes to erase.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_ADDRESS_ERROR if the destination address range is not completely within the addressable areas of the device(s).</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Due to flash memory design, the range actually erased may be larger than what was specified by the Offset &amp; Bytes parameters. This will occur if the parameters do not align to block boundaries. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="gab4c908ad78f6ded9407d0dc7ed611370"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Initialize </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>BaseAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>BusWidth</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>IsPlatformFlash</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function initializes a specific XFlash instance. </p>
<p>The initialization entails:</p>
<ul>
<li>Check the Device family type.</li>
<li>Issuing the CFI query command.</li>
<li>Get and translate relevant CFI query information.</li>
<li>Set default options for the instance.</li>
<li>Setup the VTable.</li>
<li>Call the family initialize function of the instance.</li>
</ul>
<p>Initialize the Xilinx Platform Flash XL to Async mode if the user selects to use the Platform Flash XL in the MLD. The Platform Flash XL is an Intel CFI complaint device.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">BaseAddress</td><td>Base address of the flash memory. </td></tr>
    <tr><td class="paramname">BusWidth</td><td>Total width of the flash memory, in bytes </td></tr>
    <tr><td class="paramname">IsPlatformFlash</td><td>Used to specify if the flash is a platform flash.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
</ul>
</dd></dl>
<ul>
<li>XFLASH_PART_NOT_SUPPORTED if the command set algorithm or Layout is not supported by any flash family compiled into the system.</li>
<li>XFLASH_CFI_QUERY_ERROR if the device would not enter CFI query mode. Either the device(s) do not support CFI, the wrong BaseAddress param was used, an unsupported part layout exists, or a hardware problem exists with the part.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>BusWidth is not the width of an individual part. Its the total operating width. For example, if there are two 16-bit parts, with one tied to data lines D0-D15 and other tied to D15-D31, BusWidth would be (32 / 8) = 4. If a single 16-bit flash is in 8-bit mode, then BusWidth should be (8 / 8) = 1. </dd></dl>

<p>References <a class="el" href="xilflash__cfi_8h.html#a025ba2cd783a06301dc7caa4fb537d95">XFlashCFI_ReadCommon()</a>.</p>

<p>Referenced by <a class="el" href="xilflash__devicecontrol__example_8c.html#a5fa72d691594e1137b534052172c88c8">FlashDeviceControlExample()</a>, <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="ga58e08e78cda5a44e67a7ec99fab303d0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_IsReady </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function checks the readiness of the device, which means it has been successfully initialized. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE if the device has been initialized (but not necessarily started), and FALSE otherwise.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a class="anchor" id="ga61597f564c68519fd4449b9fe6c50339"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Lock </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function Locks the blocks in the specified range of the flash device(s). </p>
<p>The device is polled until an error or the operation completes successfully.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Offset</td><td>Offset into the device(s) address space from which to begin block locking. The first three bytes of every block is reserved for special purpose. The offset should be at least three bytes from start of the block. </td></tr>
    <tr><td class="paramname">Bytes</td><td>Number of bytes to Lock in the Block starting from Offset.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
</ul>
</dd></dl>
<ul>
<li>XFLASH_ADDRESS_ERROR if the destination address range is not completely within the addressable areas of the device(s).</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>Due to flash memory design, the range actually locked may be larger than what was specified by the Offset &amp; Bytes parameters. This will occur if the parameters do not align to block boundaries. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>.</p>

</div>
</div>
<a class="anchor" id="ga2b079c7388012f6bdbda754ea0d62641"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Read </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Bytes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>DestPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function reads the data from the Flash device and copies it into the specified user buffer. </p>
<p>The source and destination addresses can be on any alignment supported by the processor.</p>
<p>The device is polled until an error or the operation completes successfully.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Offset</td><td>Offset into the device(s) address space from which to read. </td></tr>
    <tr><td class="paramname">Bytes</td><td>Number of bytes to copy. </td></tr>
    <tr><td class="paramname">DestPtr</td><td>Destination address to copy data to.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_ADDRESS_ERROR if the source address does not start within the addressable areas of the device(s).</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This function allows the transfer of data past the end of the device's address space. If this occurs, then results are undefined. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="gacef8005e70142f8113fa163cb5a187f5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Reset </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function resets the flash device and places it in read mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_BUSY if the flash devices were in the middle of an operation and could not be reset.</li>
<li>XFLASH_ERROR if the device(s) have experienced an internal error during the operation. <a class="el" href="group__xilflash__apis.html#gaee7e52b5702a9d346c97ceb56fd4829c" title="This function is used to execute device specific commands. ">XFlash_DeviceControl()</a> must be used to access the cause of the device specific error. condition.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__devicecontrol__example_8c.html#a5fa72d691594e1137b534052172c88c8">FlashDeviceControlExample()</a>, <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="gad42077db3972cee5f052a5a5063fe538"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Unlock </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function Unlocks the blocks in the specified range of the flash device(s). </p>
<p>The device is polled until an error or the operation completes successfully.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Offset</td><td>Offset into the device(s) address space from which to begin block UnLocking. The first three bytes of every block is reserved for special purpose. The offset should be at least three bytes from start of the block. </td></tr>
    <tr><td class="paramname">Bytes</td><td>Number of bytes to UnLock in the Block starting from Offset.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_ADDRESS_ERROR if the destination address range is not completely within the addressable areas of the device(s).</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
<a class="anchor" id="gadeef4a4805428c7a14578bc0790d6bdc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlash_Write </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Bytes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>SrcPtr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function programs the flash device(s) with data specified in the user buffer. </p>
<p>The source and destination address must be aligned to the width of the flash's data bus.</p>
<p>The device is polled until an error or the operation completes successfully.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>Pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">Offset</td><td>Offset into the device(s) address space from which to begin programming. Must be aligned to the width of the flash's data bus. </td></tr>
    <tr><td class="paramname">Bytes</td><td>Number of bytes to program. </td></tr>
    <tr><td class="paramname">SrcPtr</td><td>Source address containing data to be programmed. Must be aligned to the width of the flash's data bus. The SrcPtr doesn't have to be aligned to the flash width if the processor supports unaligned access. But, since this library is generic, and some processors(eg. Microblaze) do not support unaligned access; this API requires the SrcPtr to be aligned.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_ERROR if a write error occurred. This error is usually device specific. Use <a class="el" href="group__xilflash__apis.html#gaee7e52b5702a9d346c97ceb56fd4829c" title="This function is used to execute device specific commands. ">XFlash_DeviceControl()</a> to retrieve specific error conditions. When this error is returned, it is possible that the target address range was only partially programmed.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__protection__example_8c.html#ad7728df460c41edfb9f3de817c6c0987">FlashProtectionExample()</a>, <a class="el" href="xilflash__readwrite__example_8c.html#a69bd7230f7feb6b13978ff0cd4cd0888">FlashReadWriteExample()</a>, and <a class="el" href="xilflash__platform__flash__example_8c.html#a94e3273884a3c3c563cbc6c1c597e38f">PlatformFlashReadWriteExample()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
